Skip to content

fix(hooks): offer the code extension when git-kb code is not installed - #18

Merged
gold-silver-copper merged 3 commits into
mainfrom
fix/code-extension-split
Dec 1, 2026
Merged

gold-silver-copper merged 3 commits into
mainfrom
fix/code-extension-split

Conversation

@gold-silver-copper

@gold-silver-copper gold-silver-copper commented Dec 1, 2026 •

Copy link
Copy Markdown
Contributor

gitkb/gitkb-core#1701 moved git-kb code into the git-kb-code extension, which core runs only when it is on PATH (crates/gitkb-cli/src/plugin.rs). Before this change, SessionStart recommended git-kb code … whenever core git-kb was installed, and on a 1.0 core-only install those commands fail.

The hook now runs git-kb code --help. It is accurate for both kinds of install: before 1.0.0 (the current public release, 0.2.19) code is built in, and from 1.0.0 it is the extension. Looking for git-kb-code on PATH would wrongly report "missing" for every 0.2.x user.

  • git-kb code works: same guidance as before. A full KB gets git-kb doctor --check repos,kb --json and git-kb code doctor --json.
  • It doesn't: no git-kb code commands. The hook says code intelligence needs the extension and to use raw search for now. It offers curl -fsSL https://get.gitkb.com/install.sh | bash (installs the extensions from 1.0.0) or the release's gitkb-code-<platform>.tar.gz. It does not offer Homebrew, because that formula installs git-kb alone. A full KB still gets git-kb doctor --check repos,kb --json.

The replacement of git-kb doctor --check repos,code,kb was already merged in #16.

Tests: the shared setup puts a stub git-kb-code on PATH. The two new cases (plain repo, full KB) wrap git-kb so that git-kb code fails. Both work with CI's 0.2.19 and with post-split core.

Checks (devbox): make release-check passes, including all 14 bats tests, shellcheck 0.10.0 and claude plugin validate; its warnings (missing icon, README install line) were already there. All 14 bats tests also pass against a post-split core build (a837694fd), and there git-kb code --help exits 2 when the extension is missing. Mutation check: making the probe always succeed fails exactly the two new tests.

Review

Changes from the review panel (opus, sol, astra), in commit 85e27eb:

  • Fresh-install guidance: when git-kb is missing, the hook no longer tells the user to run git-kb code doctor / git-kb code index unconditionally. It says to check git-kb code --help after installing, and to use grep and file reads if that fails. tests/session-start.bats requires both halves.
  • Bundled skill: plugin/skills/gitkb/SKILL.md adds the same probe to First Checks (… && echo code-available || echo code-missing). On code-missing the agent runs no git-kb code commands, uses grep and file reads, and offers the extension. The code sections are now explicitly "when git-kb code is available".
  • README MCP section: code-only MCP does exist. From 1.0.0, git-kb-code mcp serves a plain Git repo (git-kb-code/src/main.rs CodeCommands::Mcp → context::find_code_root, which accepts GitOnly), and git-kb code init claude registers it. The README now separates "this plugin registers no MCP server" from "core git-kb mcp needs a full KB". The hook and the skill no longer say "MCP is supported after full KB setup today".
  • Test doubles guard the probe's argv: the stub git-kb-code succeeds only for exactly --help; the core-only wrapper and the "git unavailable" stub match only code --help. Mutation: probe changed to git-kb code --hlep → tests 1, 4, 5, 10 fail on both the devbox's pre-split core and a post-split core. With the old doubles on post-split core, those four passed.
  • Nits taken: the missing-extension text says "git-kb code --help failed" rather than "not installed". The install script is described as adding the extensions only with GitKB 1.0.0 and later. The full-KB sentence no longer reads "… or X, and Y".

Checks (devbox): make release-check passes, including 14/14 bats, shellcheck 0.10.0 and claude plugin validate (same pre-existing warnings). 14/14 bats also pass with post-split core first on PATH.

git-kb code moved out of core into the git-kb-code extension, which git-kb runs from PATH. SessionStart now checks for git-kb-code before recommending git-kb code commands or git-kb code doctor, and offers installation when only core is installed.
@coderabbitai

coderabbitai Bot commented Dec 1, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The session-start script now selects code-intelligence guidance based on GitKB setup state and whether git-kb-code is available. Tests cover core-only installations in plain Git repositories and full KB setups.

Changes

Session-start guidance

Layer / File(s) Summary
Setup guidance and coverage
plugin/scripts/session-start.sh, tests/helpers/setup.bash, tests/session-start.bats
The script reuses installation instructions and provides code-intelligence guidance based on setup state and extension availability. Test helpers add a git-kb-code stub, and tests check guidance for core-only installations.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Possibly related PRs

Suggested reviewers: mateodelnorte

Merge Risk: Minimal · up to 83093

This change updates session-start guidance to match the move of code intelligence into the git-kb-code extension. The guidance is limited to messages and is covered by tests, so merge risk is minimal. Installs older than 1.0.0 that still have code intelligence built in may be shown raw-search guidance instead.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title states the main change: the SessionStart hook now offers code-extension installation guidance when git-kb code is not installed. The raw summary confirms the hook branches on the git-kb-code…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Full details: Title check

Explanation

The title states the main change: the SessionStart hook now offers code-extension installation guidance when git-kb code is not installed. The raw summary confirms the hook branches on the git-kb-code extension, adds core-only guidance, and adds tests for that case. The title uses the conventional fix(hooks) prefix and is specific, so it passes.

Finishing Touches

Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

A rabbit checks the setup path,
And leaves clear notes for code to find.
If extensions are not in place,
It points to where they wait.
The KB guidance stays in view,
While carrots hop through tests anew.

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: ASSERTIVE
  • Plan: Team
  • Run ID: f580ff28-1e06-4916-ad2f-09da39832d49
Commits

Reviewing files that changed from the base of the PR and between 96b3c24 and 8309396.

Files selected for processing: 3

  • plugin/scripts/session-start.sh
  • tests/helpers/setup.bash
  • tests/session-start.bats

Included review availability: This review used your included allowance. 0 included reviews remain after this review. Your included PR review attempts over the past 7 days set your current allowance at 1 review per hour.

@coderabbitai
coderabbitai Bot requested a review from mateodelnorte December 1, 2026 00:18
git-kb before 1.0.0 has git-kb code built in, with no git-kb-code program, so looking for git-kb-code on PATH reported current releases as lacking code intelligence. Run git-kb code --help instead, which answers for both, and drop the claim that Homebrew installs the extension.
@gold-silver-copper
gold-silver-copper merged commit bf7b118 into main Dec 1, 2026
3 checks passed
@gold-silver-copper
gold-silver-copper deleted the fix/code-extension-split branch December 1, 2026 02:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant